package com.stephen.redisdemo.controller;


import com.stephen.redisdemo.service.CommodityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created by ssc on 2020-03-30 10:22 .
 * Description:
 */
@RestController
public class CommodityController {

    @Autowired
    private CommodityService commodityService;

    @GetMapping("findAll")
    public Object findAll() {
        return commodityService.findAll();
    }

    @GetMapping("/find/{id}")
    public Object find(@PathVariable Integer id) {
        return commodityService.findById(id);
    }

    @DeleteMapping("/delete/{id}")
    public Object delete(@PathVariable Integer id) {
        commodityService.deleteById(id);
        return "success";
    }


    @GetMapping()
    public Object hello() {
        return "hello";
    }


}
